<html lang="zh"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script data-ezscrex='false' data-cfasync='false' data-pagespeed-no-defer>var __ez=__ez||{};__ez.stms=Date.now();__ez.evt={};__ez.script={};__ez.ck=__ez.ck||{};__ez.template={};__ez.template.isOrig=false;__ez.queue=function(){var e=0,i=0,t=[],n=!1,o=[],r=[],s=!0,a=function(e,i,n,o,r,s,a){var l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:window,d=this;this.name=e,this.funcName=i,this.parameters=null===n?null:p(n)?n:[n],this.isBlock=o,this.blockedBy=r,this.deleteWhenComplete=s,this.isError=!1,this.isComplete=!1,this.isInitialized=!1,this.proceedIfError=a,this.fWindow=l,this.isTimeDelay=!1,this.process=function(){f("... func = "+e),d.isInitialized=!0,d.isComplete=!0,f("... func.apply: "+e);var i=d.funcName.split("."),n=null,o=this.fWindow||window;i.length>3||(n=3===i.length?o[i[0]][i[1]][i[2]]:2===i.length?o[i[0]][i[1]]:o[d.funcName]),null!=n&&n.apply(null,this.parameters),!0===d.deleteWhenComplete&&delete t[e],!0===d.isBlock&&(f("----- F'D: "+d.name),u())}},l=function(e,i,t,n,o,r,s){var a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:window,l=this;this.name=e,this.path=i,this.async=o,this.defer=r,this.isBlock=t,this.blockedBy=n,this.isInitialized=!1,this.isError=!1,this.isComplete=!1,this.proceedIfError=s,this.fWindow=a,this.isTimeDelay=!1,this.isPath=function(e){return"/"===e[0]&&"/"!==e[1]},this.getSrc=function(e){return void 0!==window.__ezScriptHost&&this.isPath(e)&&"banger.js"!==this.name?window.__ezScriptHost+e:e},this.process=function(){l.isInitialized=!0,f("... file = "+e);var i=this.fWindow?this.fWindow.document:document,t=i.createElement("script");t.src=this.getSrc(this.path),!0===o?t.async=!0:!0===r&&(t.defer=!0),t.onerror=function(){var e={url:window.location.href,name:l.name,path:l.path,user_agent:window.navigator.userAgent};"undefined"!=typeof _ezaq&&(e.pageview_id=_ezaq.page_view_id);var i=encodeURIComponent(JSON.stringify(e)),t=new XMLHttpRequest;t.open("GET","//g.ezoic.net/ezqlog?d="+i,!0),t.send(),f("----- ERR'D: "+l.name),l.isError=!0,!0===l.isBlock&&u()},t.onreadystatechange=t.onload=function(){var e=t.readyState;f("----- F'D: "+l.name),e&&!/loaded|complete/.test(e)||(l.isComplete=!0,!0===l.isBlock&&u())},i.getElementsByTagName("head")[0].appendChild(t)}},d=function(e,i){this.name=e,this.path="",this.async=!1,this.defer=!1,this.isBlock=!1,this.blockedBy=[],this.isInitialized=!0,this.isError=!1,this.isComplete=i,this.proceedIfError=!1,this.isTimeDelay=!1,this.process=function(){}};function c(e){!0!==h(e)&&0!=s&&e.process()}function h(e){if(!0===e.isTimeDelay&&!1===n)return f(e.name+" blocked = TIME DELAY!"),!0;if(p(e.blockedBy))for(var i=0;i<e.blockedBy.length;i++){var o=e.blockedBy[i];if(!1===t.hasOwnProperty(o))return f(e.name+" blocked = "+o),!0;if(!0===e.proceedIfError&&!0===t[o].isError)return!1;if(!1===t[o].isComplete)return f(e.name+" blocked = "+o),!0}return!1}function f(e){var i=window.location.href,t=new RegExp("[?&]ezq=([^&#]*)","i").exec(i);"1"===(t?t[1]:null)&&console.debug(e)}function u(){++e>200||(f("let's go"),m(o),m(r))}function m(e){for(var i in e)if(!1!==e.hasOwnProperty(i)){var t=e[i];!0===t.isComplete||h(t)||!0===t.isInitialized||!0===t.isError?!0===t.isError?f(t.name+": error"):!0===t.isComplete?f(t.name+": complete already"):!0===t.isInitialized&&f(t.name+": initialized already"):t.process()}}function p(e){return"[object Array]"==Object.prototype.toString.call(e)}return window.addEventListener("load",(function(){setTimeout((function(){n=!0,f("TDELAY -----"),u()}),5e3)}),!1),{addFile:function(e,i,n,s,a,d,h,f,u){var m=new l(e,i,n,s,a,d,h,u);!0===f?o[e]=m:r[e]=m,t[e]=m,c(m)},addDelayFile:function(e,i){var n=new l(e,i,!1,[],!1,!1,!0);n.isTimeDelay=!0,f(e+" ...  FILE! TDELAY"),r[e]=n,t[e]=n,c(n)},addFunc:function(e,n,s,l,d,h,f,u,m,p){!0===h&&(e=e+"_"+i++);var w=new a(e,n,s,l,d,f,u,p);!0===m?o[e]=w:r[e]=w,t[e]=w,c(w)},addDelayFunc:function(e,i,n){var o=new a(e,i,n,!1,[],!0,!0);o.isTimeDelay=!0,f(e+" ...  FUNCTION! TDELAY"),r[e]=o,t[e]=o,c(o)},items:t,processAll:u,setallowLoad:function(e){s=e},markLoaded:function(e){if(e&&0!==e.length){if(e in t){var i=t[e];!0===i.isComplete?f(i.name+" "+e+": error loaded duplicate"):(i.isComplete=!0,i.isInitialized=!0)}else t[e]=new d(e,!0);f("markLoaded dummyfile: "+t[e].name)}},logWhatsBlocked:function(){for(var e in t)!1!==t.hasOwnProperty(e)&&h(t[e])}}}();__ez.evt.add=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n()},__ez.evt.remove=function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):delete e["on"+t]};__ez.script.add=function(e){var t=document.createElement("script");t.src=e,t.async=!0,t.type="text/javascript",document.getElementsByTagName("head")[0].appendChild(t)};__ez.dot={};__ez.queue.addFile('/detroitchicago/boise.js', '/detroitchicago/boise.js?gcb=195-2&cb=2', true, [], true, false, true, false);__ez.queue.addFile('/parsonsmaize/abilene.js', '/parsonsmaize/abilene.js?gcb=195-2&cb=28', true, [], true, false, true, false);</script>
<script data-ezscrex="false" type="text/javascript" data-cfasync="false">window._ezaq = Object.assign({}, typeof window._ezaq !== "undefined" ? window._ezaq : {}, {"ad_cache_level":1,"domain_id":173770,"ezcache_level":2,"ezcache_skip_code":0,"has_bad_image":0,"has_bad_words":0,"is_sitespeed":0,"lt_cache_level":0,"page_view_id":"14c484c6-3a51-4565-5b43-ea600235241a","response_size_orig":91777,"response_time_orig":4,"template_id":134,"url":"https://plantuml.com/zh/preprocessing","word_count":2710,"worst_bad_word_level":0});__ez.queue.markLoaded('ezaqBaseReady');</script>
<script type="text/javascript">(function(){function storageAvailable(type){var storage;try{storage=window[type];var x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return true;}
catch(e){return e instanceof DOMException&&(e.code===22||e.code===1014||e.name==='QuotaExceededError'||e.name==='NS_ERROR_DOM_QUOTA_REACHED')&&(storage&&storage.length!==0);}}
function remove_ama_config(){if(storageAvailable('localStorage')){localStorage.removeItem("google_ama_config");}}
remove_ama_config()})()</script>
<script type="text/javascript">var ezoicTestActive = true</script>
<script data-ezscrex="false" type="text/javascript" data-cfasync="false">window._ezaq = Object.assign({}, typeof window._ezaq !== "undefined" ? window._ezaq : {}, {"ab_test_id":"mod174-c","ad_cache_level":1,"ad_count_adjustment":0,"ad_lazyload_version":0,"ad_load_version":1,"ad_location_ids":"","adx_ad_count":0,"ai_placeholder_cache_level":1,"ai_placeholder_placement_cnt":-1,"bidder_method":1,"bidder_version":3,"city":"Krasnoyarsk","country":"RU","days_since_last_visit":-1,"display_ad_count":0,"domain_id":173770,"domain_test_group":20230802,"ds_adsize_opt_id":-1,"engaged_time_visit":0,"ezcache_level":2,"ezcache_skip_code":0,"form_factor_id":1,"framework_id":1,"has_bad_image":0,"has_bad_words":0,"iab_category":"","iab_category_0":"596","is_embed":false,"is_from_recommended_pages":false,"is_return_visitor":false,"is_sitespeed":0,"last_page_load":"","last_pageview_id":"","lt_cache_level":0,"max_ads":0,"metro_code":0,"optimization_version":1,"page_ad_positions":"","page_view_count":316,"page_view_id":"14c484c6-3a51-4565-5b43-ea600235241a","position_selection_id":0,"postal_code":"660000","pv_event_count":0,"response_size_orig":91777,"response_time_orig":4,"serverid":"i-01330c5887ea3c035","state":"KYA","sub_page_ad_positions":"","t_epoch":1697690915,"template_id":134,"time_on_site_visit":0,"url":"https://plantuml.com/zh/preprocessing","word_count":2710,"worst_bad_word_level":0});__ez.queue.markLoaded('ezaqReady');</script>
<script data-ezscrex='false' data-cfasync='false' data-pagespeed-no-defer>__ez.queue.addFile('/parsonsmaize/mulvane.js', '/parsonsmaize/mulvane.js?gcb=195-2&cb=5', true, ['/parsonsmaize/abilene.js'], true, false, true, false);__ez.queue.addFile('/parsonsmaize/olathe.js', '/parsonsmaize/olathe.js?gcb=195-2&cb=20', false, ['/parsonsmaize/abilene.js','/parsonsmaize/mulvane.js'], true, false, true, false);__ez.queue.addFile('/porpoiseant/et.js', '/porpoiseant/et.js?gcb=195-2&cb=2', false, [], true, false, true, false);!function(){var e;__ez.vep=(e=[],{Add:function(i,t){__ez.dot.isDefined(i)&&__ez.dot.isValid(t)&&e.push({type:"video",video_impression_id:i,domain_id:__ez.dot.getDID(),t_epoch:__ez.dot.getEpoch(0),data:__ez.dot.dataToStr(t)})},Fire:function(){if(void 0===document.visibilityState||"prerender"!==document.visibilityState){if(__ez.dot.isDefined(e)&&e.length>0)for(;e.length>0;){var i=5;i>e.length&&(i=e.length);var t=e.splice(0,i),o=__ez.dot.getURL("/detroitchicago/grapefruit.gif")+"?orig="+(!0===__ez.template.isOrig?1:0)+"&v="+btoa(JSON.stringify(t));__ez.dot.Fire(o)}e=[]}}})}();</script><script data-ezscrex='false' data-cfasync='false' data-pagespeed-no-defer>!function(){function e(i){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(i)}__ez.pel=function(){var i=[];function t(t,o,d,_,n,r,a,s){if(__ez.dot.isDefined(t)&&0!=__ez.dot.isAnyDefined(t.getSlotElementId,t.ElementId)){void 0===s&&(s=!1);var p=parseInt(__ez.dot.getTargeting(t,"ap")),f=__ez.dot.getSlotIID(t),u=__ez.dot.getAdUnit(t,s),z=parseInt(__ez.dot.getTargeting(t,"compid")),g=0,c=0,l=function(i){if("undefined"==typeof _ezim_d)return!1;var t=__ez.dot.getAdUnitPath(i).split("/").pop();if("object"===("undefined"==typeof _ezim_d?"undefined":e(_ezim_d))&&_ezim_d.hasOwnProperty(t))return _ezim_d[t];for(var o in _ezim_d)if(o.split("/").pop()===t)return _ezim_d[o];return!1}(t);"object"==e(l)&&(void 0!==l.creative_id&&(c=l.creative_id),void 0!==l.line_item_id&&(g=l.line_item_id)),__ez.dot.isDefined(f,u)&&__ez.dot.isValid(o)&&("0"===f&&!0!==s||""===u||i.push({type:"impression",impression_id:f,domain_id:__ez.dot.getDID(),unit:u,t_epoch:__ez.dot.getEpoch(0),revenue:d,est_revenue:_,ad_position:p,ad_size:"",bid_floor_filled:n,bid_floor_prev:r,stat_source_id:a,country_code:__ez.dot.getCC(),pageview_id:__ez.dot.getPageviewId(),comp_id:z,line_item_id:g,creative_id:c,data:__ez.dot.dataToStr(o),is_orig:s||__ez.template.isOrig}))}}function o(){void 0!==document.visibilityState&&"prerender"===document.visibilityState||(__ez.dot.isDefined(i)&&i.length>0&&[i.filter((function(e){return e.is_orig})),i.filter((function(e){return!e.is_orig}))].forEach((function(e){for(;e.length>0;){var i=e[0].is_orig||!1,t=5;t>e.length&&(t=e.length);var o=e.splice(0,t),d=__ez.dot.getURL("/porpoiseant/army.gif")+"?orig="+(!0===i?1:0)+"&sts="+btoa(JSON.stringify(o));(void 0!==window.isAmp&&isAmp||void 0!==window.ezWp&&ezWp)&&void 0!==window._ezaq&&_ezaq.hasOwnProperty("domain_id")&&(d+="&visit_uuid="+_ezaq.visit_uuid),__ez.dot.Fire(d)}})),i=[])}return{Add:t,AddAndFire:function(e,i){t(e,i,0,0,0,0,0),o()},AddAndFireOrig:function(e,i){t(e,i,0,0,0,0,0,!0),o()},AddById:function(e,t,o,d){var _=e.split("/");if(__ez.dot.isDefined(e)&&3===_.length&&__ez.dot.isValid(t)){var n=_[0],r={type:"impression",impression_id:_[2],domain_id:__ez.dot.getDID(),unit:n,t_epoch:__ez.dot.getEpoch(0),pageview_id:__ez.dot.getPageviewId(),data:__ez.dot.dataToStr(t),is_orig:o||__ez.template.isOrig};void 0!==d&&(r.revenue=d),i.push(r)}},Fire:o,GetPixels:function(){return i}}}()}();__ez.queue.addFile('/detroitchicago/raleigh.js', '/detroitchicago/raleigh.js?gcb=195-2&cb=6', false, ['/parsonsmaize/abilene.js'], true, false, true, false);__ez.queue.addFile('/detroitchicago/vista.js', '/detroitchicago/vista.js?gcb=195-2&cb=5', false, ['/parsonsmaize/abilene.js'], true, false, true, false);__ez.queue.addFile('/detroitchicago/tampa.js', '/detroitchicago/tampa.js?gcb=195-2&cb=5', false, ['/parsonsmaize/abilene.js'], true, false, true, false);</script><base href=""/><meta name="flattr:id" content="1ew3x0"/><script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organization",
  "url": "https://plantuml.com",
  "name": "PlantUML",
  "sameAs" : ["https://twitter.com/plantuml","https://en.wikipedia.org/wiki/PlantUML","https://www.wikidata.org/wiki/Q18346546"],
  "logo": "https://cdn-0.plantuml.com/logo3.png",
  "contactPoint": [{
    "@type": "ContactPoint",
    "email": "plantuml@gmail.com",
    "url": "https://plantuml.com",
    "contactType": "customer service"
  }]
}
</script><script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [{
    "@type": "ListItem",
    "position": 1,
    "item": {
      "@id": "https://plantuml.com",
      "name": "Home"
    }
  },{
    "@type": "ListItem",
    "position": 2,
    "item": {
      "@id": "https://plantuml.com/sitemap-language-specification",
      "name": "Language specification"
    }
  },{
    "@type": "ListItem",
    "position": 3,
    "item": {
      "@id": "https://plantuml.com/preprocessing",
      "name": "Preprocessing"
  }
  }]
}
</script><link rel="canonical" href="preprocessing.html"/><link rel="alternate" hreflang="x-default" href="../preprocessing.html"/><link rel="alternate" hreflang="de" href="../de/preprocessing.html"/><link rel="alternate" hreflang="en" href="../preprocessing.html"/><link rel="alternate" hreflang="es" href="../es/preprocessing.html"/><link rel="alternate" hreflang="fr" href="../fr/preprocessing.html"/><link rel="alternate" hreflang="ja" href="../ja/preprocessing.html"/><link rel="alternate" hreflang="ru" href="../ru/preprocessing.html"/><link rel="alternate" hreflang="ko" href="../ko/preprocessing.html"/><link rel="alternate" hreflang="zh" href="preprocessing.html"/><link rel="shortcut icon" href="../favicon.ico"/><link rel="preload" as="image" href="../svgrepo-house.svg"/><link rel="preload" as="image" href="../svgrepo-text-news.svg"/><link rel="preload" as="image" href="../svgrepo-rocket-3-start.svg"/><link rel="preload" as="image" href="../svgrepo-server.svg"/><link rel="preload" as="image" href="../svgrepo-play.svg"/><link rel="preload" as="image" href="../svgrepo-forum.svg"/><link rel="preload" as="image" href="../svgrepo-add-to-online-cart.svg"/><link rel="preload" as="image" href="../svgrepo-forum-message.svg"/><link rel="preload" as="image" href="../svgrepo-palette-fill.svg"/><link rel="preload" as="image" href="../svgrepo-cpu.svg"/><link rel="preload" as="image" href="../svgrepo-books-library.svg"/><link rel="preload" as="image" href="../svgrepo-signpost-fill.svg"/><link rel="preload" as="image" href="../svgrepo-library.svg"/><link rel="preload" as="image" href="../flags21.png"/><link rel="preload" as="image" href="../svgrepo-uxwing-light-mode-toggle.svg"/><title>Use the preprocessor</title><meta name="description" content="The PlantUML preprocessor provides features close to the C preprocessor. You can include files, define constant and macros. It&#39;s also possible to use conditional."/><meta property="og:type" content="article"/><meta property="og:url" content="https://plantuml.com/zh/preprocessing"/><meta property="og:site_name" content="PlantUML.com"/><meta name="twitter:image" content="https://plantuml.com/og-preprocessing"/><meta property="og:locale" content="zh"/><meta name="twitter:card" content="summary"/><meta name="twitter:site" content="@PlantUML"/><meta name="twitter:creator" content="@PlantUML"/><style>li{margin:2px}#external li{margin:13px}.pezoic{max-width:970px}@media screen and (max-width:1600px){.pezoic{max-width:768px}}.coptable{max-width:90%}.mytab{display:inline-block;border-radius:3px;border:1px solid #e1e4e8}.mytab:hover{border:1px dashed #0366d6;cursor:pointer;color:#0366d6;background:#f6f8fa}.cop{margin:25px 10px 0 10px}.cop:hover{cursor:pointer;filter:invert(30%) sepia(75%) saturate(4001%) hue-rotate(201deg) brightness(88%) contrast(98%)}.cop2{margin:25px 10px 0 10px}.cop2:hover{cursor:pointer}.msg{position:absolute;color:#396;background-color:#FFF;margin-top:55px;display:none;border-radius:3px;border:1px solid #4dff00}.mycell0{float:left;vertical-align:top;padding:10px}.mycell0 code:hover{cursor:default;color:#000}.mycell{float:right;vertical-align:top;padding:10px;max-width:55vw;overflow-x:auto}.mycell0 pre{max-width:55vw;overflow-x:auto}.cod{background:#edeff3;padding:2px 5px;border-radius:3px}.colo{display:inline-block;background:#edeff3;padding:7px 12px;border-radius:3px}.tag,.tagg,.tago,.tagr{text-rendering:optimizeLegibility;display:inline-block;padding:3px 5px 2px 4px;text-decoration:none;white-space:nowrap;border:1px solid #999;text-transform:uppercase;text-align:center;border-radius:3px;font-size:11px;font-weight:bold;line-height:90%}.tag{background-color:#eee}.tagg{background-color:#98fb98}.tago{background-color:#fafa00}.tagr{background-color:#ff4500}a{text-decoration:none;color:#0366d6}a:hover{text-decoration:underline}.menu1{border:0;font-family:Helvetica,sans-serif;font-size:14px;padding:0;margin:0;white-space:nowrap;overflow:hidden;vertical-align:middle;line-height:30px}.menu1 a{text-align:center;padding:10px 7px 10px 7px;text-decoration:none;color:#637282}.menu1 a:hover{color:#0366d6}#menu0{top:0;z-index:4;margin:0 0 0 10px;padding:0}@media screen and (max-width:1200px){#menu0{visibility:hidden}}.mhov img{margin:0 5px 0 0;padding:0}.mhov:hover{filter:invert(25%) sepia(97%) saturate(2026%) hue-rotate(201deg) brightness(91%) contrast(98%)}#menuside2{border:0;font-family:Helvetica,sans-serif;font-size:14px;padding:20px 0 4px 0;margin:0}#menuside2 span{vertical-align:top}#menuside2 li{list-style:none;position:relative;padding:0;margin:10px 20px 10px 10px;border:0}#menuside2 li a{display:inline-block;text-decoration:none;color:#637282;width:100%}#BC{z-index:0;padding-top:5px;top:35px}.breadcrumb{z-index:1;font-family:Helvetica,sans-serif;font-size:14px;text-align:center;display:inline-block;overflow:hidden;border-radius:5px}.breadcrumb a{text-decoration:none;outline:0;display:block;float:left;font-size:12px;line-height:24px;color:#373f49;padding:0 10px 0 35px;background:#f0f1f1;background:linear-gradient(#f0f1f1,#c6d2d2);position:relative}.breadcrumb a:first-child{padding-left:21px;border-radius:5px 0 0 5px}.breadcrumb a:first-child:before{left:14px}.breadcrumb a:last-child{visibility:hidden}.breadcrumb a.active,.breadcrumb a:hover{color:#0366d6;background:#c6d2d2;background:linear-gradient(#e3e4e4,#b8c7c7)}.breadcrumb a.active:after,.breadcrumb a:hover:after{background:#c6d2d2;background:linear-gradient(135deg,#e3e4e4,#b8c7c7)}.breadcrumb a:after{content:'';position:absolute;top:0;right:-12px;width:24px;height:24px;transform:scale(0.707) rotate(45deg);z-index:1;background:#f0f1f1;background:linear-gradient(135deg,#f0f1f1,#c6d2d2);box-shadow:2px -2px 0 2px rgba(0,0,0,0.1),3px -3px 0 2px rgba(255,255,255,0.1);border-radius:0 5px 0 50px}.breadcrumb a:last-child:after{content:none;visibility:hidden}.lga,.lga a,.lgi,.lgi a{font-family:Helvetica,sans-serif;font-size:13px;text-align:center;color:#fff;padding:0 5px;margin:0}.lga,.lga a{background-color:#008}.lgi,.lgi a{background-color:#888}.lga:hover,.lga:hover a{text-decoration:none;color:#BBB}.lgi:hover,.lgi:hover a{text-decoration:none;color:#CCC}</style><style>.backtop{margin:0 10px}.backtop:hover{cursor:pointer;filter:invert(30%) sepia(75%) saturate(4001%) hue-rotate(201deg) brightness(88%) contrast(98%)}</style><style>.dropbtn{padding:0;border:0;background:0}.dropdown{position:relative;display:inline-block;margin:0 10px}.dropdown-content{display:none;position:absolute;background-color:#f1f1f1;min-width:160px;box-shadow:0 8px 16px 0 rgba(0,0,0,0.2);z-index:1}.dropdown-content img{vertical-align:middle;margin:0 8px 0 1px}.dropdown-content a{font-size:small;font-weight:normal;color:black;padding:5px 10px;text-decoration:none;display:block}.dropdown-content a:hover{background-color:#ddd;color:#0366d6}.dropdown:hover .dropdown-content{display:block}.dropdown:hover .dropbtn{background-color:#3e8e41}</style><style>#flex1{margin:0;padding:0;display:flex;flex-direction:row;width:378px;height:100%}#lll{flex-grow:1;flex-shrink:1;max-width:162px;overflow:hidden}#mmm{flex-grow:0;flex-shrink:0;background:#edeff3;width:210px;min-width:210px;max-width:210px;flex-grow:0;flex-shrink:0;border-left:1px solid #d4d8de}#qqq{flex-grow:0;flex-shrink:0;width:4px;min-width:4px;max-width:4px;flex-grow:0;flex-shrink:0}#rrr{flex-grow:1;flex-shrink:1;max-width:162px;overflow:hidden}.cde{display:flex;flex-direction:column;justify-content:space-between;height:100%}.cd{display:flex;flex-direction:column;justify-content:space-start;height:100%}.aaa{height:30px;min-height:30px;max-height:30px;flex-grow:0;flex-shrink:0;background:#edeff3;border-bottom:1px solid #d4d8de}.bbb,.bbborder{flex-grow:1;flex-shrink:0}.bbborder{border-left:1px solid #d4d8de}#header{z-index:10;position:fixed;left:378px;right:0;height:30px;top:0;background:#edeff3;border-bottom:1px solid #d4d8de}#header2{z-index:7;position:fixed;left:378px;right:0;height:10px;top:30px;background:#fefefe}#left0{top:0;position:fixed;left:0;margin:0;bottom:0;width:378px;padding:0;z-index:2}#root{padding:0;margin:40px 0 0 388px;background:#fefefe}body{margin:auto;overflow-x:hidden;background:#fefefe}@media screen and (max-width:1190px){#flex1,#left0{width:215px}#root{margin:40px 0 0 224px}#header,#header2{left:215px}#left0{left:0}#lll,#rrr{width:0;visibility:hidden;flex-grow:0;flex-shrink:0}}@media screen and (max-width:1010px){#root{margin:0 0 0 216px}#header,#header2{display:none}#lll,#qqq{width:0;visibility:hidden;flex-grow:0;flex-shrink:0}#mmm{border-right:1px solid #d4d8de}}@media screen and (min-width:1700px){#header,#header2{left:518px}#left0,#flex1{width:518px}#root{margin-left:528px}#lll,#rrr{max-width:302px}}</style><script>window.pushMST_config={vapidPK:"BBodn2vLFoDO5AdCfmOOzNmcUsn52kTA6JNZNYVFymzEdWHonz_bkUcsaTkPXHvNGRkRUSAxMbup-H0l2sb1h_Q",enableOverlay:true,swPath:"/sw.js",i18n:{}};var pushmasterTag=document.createElement("script");pushmasterTag.src="https://cdn.pushmaster-cdn.xyz/scripts/publishers/629f5e297baecc00098a271b/SDK.js";pushmasterTag.setAttribute("defer","");var firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(pushmasterTag,firstScriptTag);</script><script async="" src="https://www.googletagmanager.com/gtag/js?id=G-TKZNNQT9CZ"></script><script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag("js",new Date());gtag("config","G-TKZNNQT9CZ");</script><script>var llg="zh";var az=0;var amdark=0;function ljs(b){if(az){return false}var a=document.createElement("script");a.type="text/javascript";a.src="/btn-"+b+".js";document.body.innerHTML="<i style='position:absolute;top:30%;width:100%;'><center>Loading in progress...";document.body.appendChild(a)}function ctc(c){document.getElementById("img"+c).classList.remove("cop");document.getElementById("img"+c).classList.add("cop2");document.getElementById("pre"+c).style.backgroundColor="#4dff00";document.getElementById("msg"+c).style.display="inline";setTimeout(function(){document.getElementById("img"+c).classList.remove("cop2");document.getElementById("img"+c).classList.add("cop");document.getElementById("pre"+c).style.backgroundColor="";document.getElementById("msg"+c).style.display="none"},800);text=document.getElementById("pre"+c).innerText;if(window.clipboardData&&window.clipboardData.setData){return window.clipboardData.setData("Text",text)}else{if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var a=document.createElement("textarea");a.textContent=text;a.style.position="fixed";document.body.appendChild(a);a.select();try{return document.execCommand("copy")}catch(b){return false}finally{document.body.removeChild(a)}}}};</script><script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><script type='text/javascript'>
var ezoTemplate = 'pub_site';
var ezouid = '1';
var ezoFormfactor = '1';
</script><script data-ezscrex="false" type='text/javascript'>
var soc_app_id = '0';
var did = 173770;
var ezdomain = 'plantuml.com';
var ezoicSearchable = 1;
</script>
<script data-ezscrex='false' data-pagespeed-no-defer data-cfasync='false'>
function create_ezolpl() {
	var d = new Date();
	d.setTime(d.getTime() + (365*24*60*60*1000));
	var expires = "expires="+d.toUTCString();
	__ez.ck.setByCat("ezux_lpl_173770=" + new Date().getTime() + "|" + _ezaq.page_view_id + "|" + _ezaq.is_return_visitor + "; " + expires, 3);
}
function attach_ezolpl() {
	if (document.readyState === "complete") {
		create_ezolpl();
		return;
	}
	window.addEventListener("load", create_ezolpl);
}

__ez.queue.addFunc("attach_ezolpl", "attach_ezolpl", null, false, ['/detroitchicago/boise.js'], true, false, false, false);
</script></head><body><div id="left0"><div id="flex1"><div id="lll"><div class="cde"><div></div><div><span id="ezoic-pub-ad-placeholder-131"></span><!-- ezoic_pub_ad_placeholder-131-sidebar-120x600-131-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-131-sidebar-160x600-131-nonexxxnonexxxxxxezmaxscaleval100 --></div><div></div></div></div><div id="mmm"><div class="cde"><div><div><span id="ezoic-pub-ad-placeholder-105"></span><!-- ezoic_pub_ad_placeholder-105-sidebar_middle-120x240-105-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-105-sidebar_middle-125x125-105-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-105-sidebar_middle-180x150-105-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-105-sidebar_middle-200x200-105-nonexxxnonexxxxxxezmaxscaleval100 --></div><ul id="menuside2"><li><a href="index.html" class="mhov"><img src="../svgrepo-house.svg" width="16" height="16"/><span>主页</span></a></li><li><a href="news.html" class="mhov"><img src="../svgrepo-text-news.svg" width="16" height="16"/><span>新鲜</span></a></li><li><a href="starting.html" class="mhov"><img src="../svgrepo-rocket-3-start.svg" width="16" height="16"/><span>入门指南</span></a></li><li><a href="https://www.plantuml.com/plantuml/uml/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000" class="mhov"><img src="../svgrepo-server.svg" width="16" height="16"/><span>Online Server</span></a></li><li><a href="running.html" class="mhov"><img src="../svgrepo-play.svg" width="16" height="16"/><span>使用</span></a></li><li><a href="faq.html" class="mhov"><img src="../svgrepo-forum.svg" width="16" height="16"/><span>常见问题</span></a></li><li><a href="download.html" class="mhov"><img src="../svgrepo-add-to-online-cart.svg" width="16" height="16"/><span>下载</span></a></li><li><a href="../qa.html" class="mhov"><img src="../svgrepo-forum-message.svg" width="16" height="16"/><span>论坛 </span></a></li><li><a href="theme.html" class="mhov"><img src="../svgrepo-palette-fill.svg" width="16" height="16"/><span>Theme</span></a></li><li><a href="preprocessing.html" class="mhov"><img src="../svgrepo-cpu.svg" width="16" height="16"/><span>预处理</span></a></li><li><a href="stdlib.html" class="mhov"><img src="../svgrepo-books-library.svg" width="16" height="16"/><span>标准库</span></a></li><li><a href="https://crashedmind.github.io/PlantUMLHitchhikersGuide" class="mhov"><img src="../svgrepo-signpost-fill.svg" width="16" height="16"/><span>Hitchhiker&#39;s Guide</span></a></li><li><a href="guide.html" class="mhov"><img src="../svgrepo-library.svg" width="16" height="16"/><span>用户指南(PDF)</span></a></li></ul><div><span id="ezoic-pub-ad-placeholder-108"></span><!-- ezoic_pub_ad_placeholder-108-sidebar_middle-120x240-108-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-108-sidebar_middle-125x125-108-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-108-sidebar_middle-180x150-108-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-108-sidebar_middle-200x200-108-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><div></div><div style="margin-bottom:35px;"><span id="ezoic-pub-ad-placeholder-186"></span><!-- ezoic_pub_ad_placeholder-186-sidebar_middle-120x240-186-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-186-sidebar_middle-125x125-186-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-186-sidebar_middle-180x150-186-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-186-sidebar_middle-200x200-186-nonexxxnonexxxxxxezmaxscaleval100 --></div></div></div><div id="qqq"><div class="cd"><div class="aaa"></div><div class="bbborder"></div></div></div><div id="rrr"><div class="cd"><div class="aaa"></div><div style="height:5px;"></div><div class="bbb"><div class="cde"><div></div><div><span id="ezoic-pub-ad-placeholder-175"></span><!-- ezoic_pub_ad_placeholder-175-sidebar-120x600-175-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-175-sidebar-160x600-175-nonexxxnonexxxxxxezmaxscaleval100 --></div><div></div></div></div></div></div></div></div><style>#contmenu{display:flex;height:30px;width:100%;margin:0;padding:0}#contmenua{height:30px;padding-right:25px}#contmenub{z-index:15;display:inline-block;flex-grow:1;flex-shrink:1;height:30px;background-color:#edeff3}#magic{white-space:nowrap;overflow:hidden;z-index:14;position:fixed;top:0;right:50px;height:30px;width:30px}#magic2{white-space:nowrap;overflow:hidden;z-index:16;position:fixed;top:0;right:0;height:30px;width:50px;background-color:#edeff3}#magic2 img{margin:5px 0 0 5px;filter:invert(44%) sepia(27%) saturate(310%) hue-rotate(170deg) brightness(92%) contrast(83%)}#magic2:hover img{filter:invert(25%) sepia(97%) saturate(2026%) hue-rotate(201deg) brightness(91%) contrast(98%)}#magic:hover #svgrepoleft{filter:invert(22%) sepia(53%) saturate(4563%) hue-rotate(202deg) brightness(95%) contrast(98%)}#magic:hover{width:100%;height:31px}#aze{height:30px;display:flex;flex-direction:row-reverse}#aze1{height:30px;background-color:#edeff3}#aze2{height:30px;background-color:#edeff3;padding-left:10px;border-left:1px solid #d4d8de;border-bottom:1px solid #d4d8de}#aze1 img{filter:invert(46%) sepia(6%) saturate(1254%) hue-rotate(171deg) brightness(94%) contrast(92%)}#aze3{width:3px;height:30px;background-color:#edeff3}</style><div id="header"><div id="contmenu"><div id="contmenua"><div class="menu1"><a href="sequence-diagram.html">时序图</a><a href="use-case-diagram.html">用例图</a><a href="class-diagram.html">类图</a><a href="activity-diagram-beta.html">活动图</a><a href="component-diagram.html">组件图</a><a href="state-diagram.html">状态图</a><a href="object-diagram.html">对象图</a><a href="deployment-diagram.html">部署图</a><a href="timing-diagram.html">定时图</a><a href="nwdiag.html">Network</a><a href="salt.html">Wireframe</a><a href="archimate-diagram.html">Archimate</a><a href="gantt-diagram.html">Gantt</a><a href="mindmap-diagram.html">MindMap</a><a href="wbs-diagram.html">WBS</a><a href="json.html">JSON</a><a href="yaml.html">YAML</a></div></div><div id="contmenub"></div></div><div id="magic"><div id="aze"><div id="aze1"><img id="svgrepoleft" width="30" height="30" src="../svgrepo-left.svg"/></div><div id="aze2"><div class="menu1"><a href="sequence-diagram.html">时序图</a><a href="use-case-diagram.html">用例图</a><a href="class-diagram.html">类图</a><a href="activity-diagram-beta.html">活动图</a><a href="component-diagram.html">组件图</a><a href="state-diagram.html">状态图</a><a href="object-diagram.html">对象图</a><a href="deployment-diagram.html">部署图</a><a href="timing-diagram.html">定时图</a><a href="nwdiag.html">Network</a><a href="salt.html">Wireframe</a><a href="archimate-diagram.html">Archimate</a><a href="gantt-diagram.html">Gantt</a><a href="mindmap-diagram.html">MindMap</a><a href="wbs-diagram.html">WBS</a><a href="json.html">JSON</a><a href="yaml.html">YAML</a></div></div><div id="aze3"></div></div></div><div id="magic2"><a href="../zh-dark/preprocessing.html"><img src="../svgrepo-uxwing-light-mode-toggle.svg" height="20"/></a></div></div><div id="header2"></div><div id="root"><style>#haut1{margin:50px 0 20px;padding:0;min-height:80px}#donate{padding-top:5px;min-height:30px}</style><div id="haut1"><div style="float:left;"><div class="breadcrumb"><a href="sitemap.html">PlantUML</a><a href="sitemap-language-specification.html">Language specification</a><a href="preprocessing.html">Preprocessing</a><a href="preprocessing.html#"></a></div><div id="donate">   <a href="https://discord.gg/sXhzexAQGh" style="text-decoration: none;"><img src="https://img.shields.io/discord/1083727021328306236?color=5865F2&amp;logo=discord&amp;logoColor=white" alt="Discord server"/></a>   <a href="https://github.com/sponsors/plantuml/" style="text-decoration: none;"><img src="https://img.shields.io/github/sponsors/plantuml?logo=github"/></a>   <a href="https://www.patreon.com/bePatron?patAmt=1&amp;u=527450&amp;rid=152970" style="text-decoration: none;"><img src="https://img.shields.io/badge/patreon-122-chocolate?logo=patreon"/></a>   <a href="../lp.html" style="text-decoration: none;"><img src="https://img.shields.io/liberapay/patrons/plantuml?color=gold&amp;logo=liberapay&amp;label=liberapay"/></a>   <a href="../en/paypal.html" style="text-decoration: none;"><img src="https://img.shields.io/badge/paypal-296-skyblue?logo=paypal&amp;logoColor=red"/></a></div></div><div style="float:right; margin:3px 0;"><style>#langlist{display:flex;justify-content:space-between;width:317px;height:16px;margin:3px 10px 3px 0}.sel2{border:2px solid #fefefe}.nosel2{border:2px solid #fefefe;filter:grayscale(100%) opacity(75%)}.sel2:hover,.nosel2:hover{cursor:pointer;border:2px solid #0366d6;border-spacing:0;filter:grayscale(0);filter:contrast(200%);filter:brightness(150%)}#flag1,#flag2,#flag3,#flag4,#flag5,#flag6,#flag7,#flag8{background:url(../flags21.png);background-repeat:no-repeat;background-clip:content-box;width:22px;height:16px}#flag2{background-position:-22px 0}#flag3{background-position:-44px 0}#flag4{background-position:-66px 0}#flag5{background-position:-88px 0}#flag6{background-position:-110px 0}#flag7{background-position:-132px 0}#flag8{background-position:-154px 0}</style><div id="langlist"><div id="flag1" onclick="location.href=&#39;/en/preprocessing&#39;" class="nosel2"></div><div id="flag2" onclick="location.href=&#39;/de/preprocessing&#39;" class="nosel2"></div><div id="flag3" onclick="location.href=&#39;/es/preprocessing&#39;" class="nosel2"></div><div id="flag4" onclick="location.href=&#39;/fr/preprocessing&#39;" class="nosel2"></div><div id="flag5" onclick="location.href=&#39;/ja/preprocessing&#39;" class="nosel2"></div><div id="flag6" onclick="location.href=&#39;/ko/preprocessing&#39;" class="nosel2"></div><div id="flag7" onclick="location.href=&#39;/ru/preprocessing&#39;" class="nosel2"></div><div id="flag8" onclick="location.href=&#39;/zh/preprocessing&#39;" class="sel2"></div></div></div></div><p><style>#topsticky{z-index:2;margin:0 240px 0 0}@media screen and (min-height:800px){#topsticky{position:sticky;top:40px}}@media screen and (max-width:1500px){#topsticky{margin:0}}</style></p><div id="topsticky"><span id="ezoic-pub-ad-placeholder-647"></span><!-- ezoic_pub_ad_placeholder-647-under_page_title-320x100-647-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-647-under_page_title-300x50v2-647-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-647-under_page_title-320x50-647-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-647-under_page_title-468x60-647-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-647-under_page_title-728x90-647-nonexxxnonexxxxxxezmaxscaleval100 --></div><p><a style="position:relative;top:-38px;" name="d397d6750cedf9d7"></a><style>#toc{z-index:2;position:sticky;top:40px;list-style-type:none;margin:0;padding:0 10px}.chap{clear:both}#toc ul{list-style-type:none;max-height:87vh;overflow-y:auto;background:#f6f8fa;border-width:2px;border-style:groove;border-radius:3px;border-color:#e1e4e8;margin:0;padding:0}@media screen and (min-height:450px){#toc ul{max-height:89.5vh}}@media screen and (min-height:550px){#toc ul{max-height:91.5vh}}@media screen and (min-height:700px){#toc ul{max-height:93.5vh}}@media screen and (min-height:900px){#toc ul{max-height:94.5vh}}#toc li{margin:5px 5px 5px 10px;padding:0}@media screen and (max-width:1500px){#toctd{display:none}#toc{display:none}}</style><table border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr valign="top" width="100%"><td valign="top"><h1 class="chap"><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#0"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#0"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#0"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>预处理</h1><p></p> 一些预处理功能包含在<strong>PlantUML</strong>中， ，并可用于<em>所有的</em>图。 <p></p> 这些功能与<a href="http://en.wikipedia.org/wiki/C_preprocessor">C语言的预处理器</a>非常相似，只是特殊字符<code class="cod">#</code> 改为感叹号<code class="cod">!</code> 。 <a style="position:relative;top:-38px;" name="788fa5fb2276ed17"></a><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#1"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#1"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#1"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>定义变量</h2><p></p> 虽然这不是必须的, 我们强烈建议变量名以 <code class="cod">$</code>开头。 <p></p> 变量有三种数据类型: <p></p><ul><li><strong>整 型</strong><em>(int)</em>；</li><li><strong>字符串</strong><em>(str)</em> - 必须被单引号或双引号包围；</li><li><strong>JSON</strong><em>(JSON)</em> - 必须被大括号包围。</li></ul><p></p><em>(JSON 变量的定义与使用, 详见 <a href="preprocessing-json.html">Preprocessing-JSON 页面</a>)</em><p></p> 在函数外创建的变量作用域是<strong>global</strong>, 你可以在任何地方访问他们 (包括函数).当定义变量的时候你可以使用 <code class="cod">global</code>强调这一点。 <p></p><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg0ad73df1edf1fb0a07c17f733110113f" class="msg"> 🎉 Copied! </div><img width="16" height="16" id="img0ad73df1edf1fb0a07c17f733110113f" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;0ad73df1edf1fb0a07c17f733110113f&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;0ad73df1edf1fb0a07c17f733110113f&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;0ad73df1edf1fb0a07c17f733110113f&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre0ad73df1edf1fb0a07c17f733110113f">@startuml
!$a  = 42
!$ab = &#34;foo1&#34;
!$cd = &#34;foo2&#34;
!$ef = $ab + $cd
!$foo = { &#34;name&#34;: &#34;John&#34;, &#34;age&#34; : 30 }

Alice -&gt; Bob : $a
Alice -&gt; Bob : $ab
Alice -&gt; Bob : $cd
Alice -&gt; Bob : $ef
Alice -&gt; Bob : Do you know **$foo.name** ?
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="196" height="244" class="scale" src="../imgw/img-0ad73df1edf1fb0a07c17f733110113f.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><p></p> 你还可以使用以下语法，仅在变量没有被定义时才对变量进行赋值： <code class="cod">!$a ?= &#34;foo&#34;</code><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg28840ac2f331b5a1f035471ea0cdc188" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img28840ac2f331b5a1f035471ea0cdc188" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;28840ac2f331b5a1f035471ea0cdc188&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;28840ac2f331b5a1f035471ea0cdc188&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;28840ac2f331b5a1f035471ea0cdc188&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre28840ac2f331b5a1f035471ea0cdc188">@startuml
Alice -&gt; Bob : 1. **$name** should be empty

!$name ?= &#34;Charlie&#34;
Alice -&gt; Bob : 2. **$name** should be Charlie

!$name = &#34;David&#34;
Alice -&gt; Bob : 3. **$name** should be David

!$name ?= &#34;Ethan&#34;
Alice -&gt; Bob : 4. **$name** should be David
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="240" height="214" class="scale" src="../imgw/img-28840ac2f331b5a1f035471ea0cdc188.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="55eb000153a81c72"></a></p><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-179"></span><!-- ezoic_pub_ad_placeholder-179-under_second_paragraph-234x60-179-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-179-under_second_paragraph-468x60-179-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-179-under_second_paragraph-728x90-179-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-179-under_second_paragraph-970x90-179-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#2"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#2"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#2"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>布尔表达式</h2><p></p><h3>布尔表示法 [0是假的]</h3><p></p> 没有真正的布尔类型，但是PlantUML使用这个整数约定： <p></p><ul><li>整数<code class="cod">0</code> 表示<code class="cod">false</code></li><li> 任何非空数字（如<code class="cod">1</code>）<strong> 或任何字符串（如<code class="cod">&#34;1&#34;</code>，</strong> 甚至<code class="cod">&#34;0&#34;</code>）* 表示<code class="cod">true</code> 。</li></ul><p></p><em>[Ref.<a href="https://forum.plantuml.net/9702/%25false-returns-0-not-false-%25true-returns-1-not-true?show=9710#a9710">QA-9702</a>]</em><p></p><h3>布尔运算和运算符 [&amp;&amp;, ||, ()]</h3> 你可以使用布尔表达式，在测试中，使用： <ul><li><em>小括号</em><code class="cod">()</code>;</li><li><em>和运算符</em><code class="cod">&amp;&amp;</code>;</li><li><em>或运算符</em><code class="cod">||</code> 。 </li></ul><p></p><em>(见下一个例子，在<code class="cod">if</code> 测试中。)</em><p></p><p></p><h3>布尔内置函数 [%false(), %true(), %not(&lt;exp&gt;)=== ]</h3> 为了方便，你可以使用这些布尔内置函数： <p></p><ul><li><code class="cod">%false()</code></li><li><code class="cod">%true()</code></li><li><code class="cod">%not(&lt;exp&gt;)</code></li></ul><p></p><p></p><em>[参见preprocessing#0umqmmdy1n9yk362kjka[内置函数]</em>] <a style="position:relative;top:-38px;" name="662c2b949d1265d3"></a><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#3"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#3"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#3"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>条件</h2><p></p><ul><li>可以在条件里使用表达式.</li><li>支持<em>else</em>语法</li></ul><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msgfc983ba6e028cb4214810303423112d5" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imgfc983ba6e028cb4214810303423112d5" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;fc983ba6e028cb4214810303423112d5&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;fc983ba6e028cb4214810303423112d5&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;fc983ba6e028cb4214810303423112d5&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="prefc983ba6e028cb4214810303423112d5">@startuml
!$a = 10
!$ijk = &#34;foo&#34;
Alice -&gt; Bob : A
!if ($ijk == &#34;foo&#34;) &amp;&amp; ($a+10&gt;=4)
Alice -&gt; Bob : yes
!else
Alice -&gt; Bob : This should not appear
!endif
Alice -&gt; Bob : B
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="103" height="184" class="scale" src="../imgw/img-fc983ba6e028cb4214810303423112d5.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="7771e9f2c2e2630a"></a></p><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-114"></span><!-- ezoic_pub_ad_placeholder-114-mid_content-234x60-114-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-114-mid_content-468x60-114-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-114-mid_content-728x90-114-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-114-mid_content-970x90-114-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#4"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#4"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#4"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>While 循环 [!while, !endwhile]</h2><p></p> 你可以使用<code class="cod">!while</code> 和<code class="cod">!endwhile</code> 关键字来实现重复循环。 <p></p><h3>While 循环（在活动图上）。</h3><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg72a2b27fa264876a0ecc8d283b1318c6" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img72a2b27fa264876a0ecc8d283b1318c6" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;72a2b27fa264876a0ecc8d283b1318c6&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;72a2b27fa264876a0ecc8d283b1318c6&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;72a2b27fa264876a0ecc8d283b1318c6&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre72a2b27fa264876a0ecc8d283b1318c6">@startuml
!procedure $foo($arg)
  :procedure start;
  !while $arg!=0
    !$i=3
    #palegreen:arg=$arg;
    !while $i!=0
      :arg=$arg and i=$i;
      !$i = $i - 1
    !endwhile
    !$arg = $arg - 1
  !endwhile
  :procedure end;
!endprocedure

start
$foo(2)
end
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="124" height="630" class="scale" src="../imgw/img-72a2b27fa264876a0ecc8d283b1318c6.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><em>[改编自<a href="https://forum.plantuml.net/10838/there-better-way-implement-while-loop-perprocess-function?show=10870#a10870">QA-10838</a>]</em><p></p><h3>While循环（在Mindmap图上）。</h3><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msge99e9dd4db9ad304f51439e648301f9d" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imge99e9dd4db9ad304f51439e648301f9d" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;e99e9dd4db9ad304f51439e648301f9d&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;e99e9dd4db9ad304f51439e648301f9d&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;e99e9dd4db9ad304f51439e648301f9d&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pree99e9dd4db9ad304f51439e648301f9d">@startmindmap
!procedure $foo($arg)
  !while $arg!=0
    !$i=3
    **[#palegreen] arg = $arg
    !while $i!=0
      *** i = $i
      !$i = $i - 1
    !endwhile
    !$arg = $arg - 1
  !endwhile
!endprocedure

*:While
Loop;
$foo(2)
@endmindmap
</pre></code></div><div class="mycell"><img loading="lazy" width="288" height="366" class="scale" src="../imgw/img-e99e9dd4db9ad304f51439e648301f9d.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><h3>While 循环(在组件/部署图上)</h3><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msgf776555ec8a34b702d113de4a023aec6" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imgf776555ec8a34b702d113de4a023aec6" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;f776555ec8a34b702d113de4a023aec6&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;f776555ec8a34b702d113de4a023aec6&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;f776555ec8a34b702d113de4a023aec6&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pref776555ec8a34b702d113de4a023aec6">@startuml
!procedure $foo($arg)
  !while $arg!=0
    [Component $arg] as $arg
    !$arg = $arg - 1
  !endwhile
!endprocedure

$foo(4)

1-&gt;2
3--&gt;4
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="457" height="167" class="scale" src="../imgw/img-f776555ec8a34b702d113de4a023aec6.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><em>[参考<a href="https://forum.plantuml.net/14088/how-to-generate-a-series-of-same-component-at-once?show=14089#a14089">QA-14088</a>]</em><a style="position:relative;top:-38px;" name="01deeaa12f04fb9d"></a><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#5"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#5"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#5"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>空函数</h2><p></p><ul><li>函数名 <em>必须</em> 以<code class="cod">$</code>开头</li><li>参数名 <em>必须</em> 以 <code class="cod">$</code>开头</li><li>空函数可以调用其他空函数</li></ul><p></p> 例: <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg78e0de0e5a9bde1eeab890360c47dcf8" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img78e0de0e5a9bde1eeab890360c47dcf8" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;78e0de0e5a9bde1eeab890360c47dcf8&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;78e0de0e5a9bde1eeab890360c47dcf8&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;78e0de0e5a9bde1eeab890360c47dcf8&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre78e0de0e5a9bde1eeab890360c47dcf8">@startuml
!procedure msg($source, $destination)
$source --&gt; $destination
!endprocedure

!procedure init_class($name)
class $name {
$addCommonMethod()
}
!endprocedure


!procedure $addCommonMethod()
  toString()
  hashCode()
!endprocedure


init_class(&#34;foo1&#34;)
init_class(&#34;foo2&#34;)
msg(&#34;foo1&#34;, &#34;foo2&#34;)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="100" height="239" class="scale" src="../imgw/img-78e0de0e5a9bde1eeab890360c47dcf8.png"/></div></div></td></tr></tbody></table></p><p></p><p></p> 函数里定义的变量作用域为<strong>local</strong>. 意味着随函数一同销毁. <a style="position:relative;top:-38px;" name="f47019cc66524b5f"></a><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-115"></span><!-- ezoic_pub_ad_placeholder-115-long_content-234x60-115-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-115-long_content-468x60-115-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-115-long_content-728x90-115-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-115-long_content-970x90-115-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#6"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#6"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#6"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>返回函数</h2><p></p> 返回函数不输出任何东西. 它只是定义了一个你可以调用的函数: <ul><li>直接在变量和图中文本中使用</li><li>被其他返回函数调用</li><li>被其他空函数调用</li></ul><p></p><p></p><ul><li>函数名 <em>应该</em> 以一个<code class="cod">$</code>开头</li><li>参数名 <em>应该</em> 以一个 <code class="cod">$</code>开关</li></ul><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msgcfb37b8251f560d29e7baf6e47b1bc30" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imgcfb37b8251f560d29e7baf6e47b1bc30" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;cfb37b8251f560d29e7baf6e47b1bc30&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;cfb37b8251f560d29e7baf6e47b1bc30&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;cfb37b8251f560d29e7baf6e47b1bc30&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="precfb37b8251f560d29e7baf6e47b1bc30">@startuml
!function $double($a)
!return $a + $a
!endfunction

Alice -&gt; Bob : The double of 3 is $double(3)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="188" height="123" class="scale" src="../imgw/img-cfb37b8251f560d29e7baf6e47b1bc30.png"/></div></div></td></tr></tbody></table></p><p></p><p></p> 可以简化函数定义为一行: <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg69ded2a313be93147715556d411a28e7" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img69ded2a313be93147715556d411a28e7" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;69ded2a313be93147715556d411a28e7&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;69ded2a313be93147715556d411a28e7&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;69ded2a313be93147715556d411a28e7&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre69ded2a313be93147715556d411a28e7">@startuml
!function $double($a) return $a + $a

Alice -&gt; Bob : The double of 3 is $double(3)
Alice -&gt; Bob : $double(&#34;This work also for strings.&#34;)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="371" height="153" class="scale" src="../imgw/img-69ded2a313be93147715556d411a28e7.png"/></div></div></td></tr></tbody></table></p><p></p><p></p> 像空函数一样, 变量默认为&#39;local&#39;本地变量 (随函数退出销毁). 并且, 你可以在函数中访问&#39;global&#39;全局变量. 并且, 如何一个全局变量已存在,你仍可以使用 <code class="cod">local</code> 关键字创建一个同名的本地变量. <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg37bef3db4f3fc2a3a08a94c48a3815c1" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img37bef3db4f3fc2a3a08a94c48a3815c1" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;37bef3db4f3fc2a3a08a94c48a3815c1&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;37bef3db4f3fc2a3a08a94c48a3815c1&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;37bef3db4f3fc2a3a08a94c48a3815c1&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre37bef3db4f3fc2a3a08a94c48a3815c1">@startuml
!procedure $dummy()
!local $ijk = &#34;local&#34;
Alice -&gt; Bob : $ijk
!endprocedure

!global $ijk = &#34;foo&#34;

Alice -&gt; Bob : $ijk
$dummy()
Alice -&gt; Bob : $ijk
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="103" height="184" class="scale" src="../imgw/img-37bef3db4f3fc2a3a08a94c48a3815c1.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="ae1b47605326b65f"></a></p><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#7"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#7"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#7"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>参数默认值</h2><p></p> 在返回和空函数中, 你可以定义参数默认值. <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg24af1b94ee7bfa5a7c634dc33cc3695d" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img24af1b94ee7bfa5a7c634dc33cc3695d" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;24af1b94ee7bfa5a7c634dc33cc3695d&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;24af1b94ee7bfa5a7c634dc33cc3695d&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;24af1b94ee7bfa5a7c634dc33cc3695d&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre24af1b94ee7bfa5a7c634dc33cc3695d">@startuml
!function $inc($value, $step=1)
!return $value + $step
!endfunction

Alice -&gt; Bob : Just one more $inc(3)
Alice -&gt; Bob : Add two to three : $inc(3, 2)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="189" height="153" class="scale" src="../imgw/img-24af1b94ee7bfa5a7c634dc33cc3695d.png"/></div></div></td></tr></tbody></table></p><p></p><p></p> 只有在尾端的参数列表才可以定义默认值. <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msgace9a5ed917d55cd0b4f44af358ca633" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imgace9a5ed917d55cd0b4f44af358ca633" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;ace9a5ed917d55cd0b4f44af358ca633&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;ace9a5ed917d55cd0b4f44af358ca633&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;ace9a5ed917d55cd0b4f44af358ca633&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="preace9a5ed917d55cd0b4f44af358ca633">@startuml
!procedure defaulttest($x, $y=&#34;DefaultY&#34;, $z=&#34;DefaultZ&#34;)
note over Alice
  x = $x
  y = $y
  z = $z
end note
!endprocedure

defaulttest(1, 2, 3)
defaulttest(1, 2)
defaulttest(1)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="104" height="300" class="scale" src="../imgw/img-ace9a5ed917d55cd0b4f44af358ca633.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="566b25a8fa128eec"></a></p><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-116"></span><!-- ezoic_pub_ad_placeholder-116-longer_content-234x60-116-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-116-longer_content-468x60-116-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-116-longer_content-728x90-116-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-116-longer_content-970x90-116-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#8"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#8"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#8"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>非引号函数</h2><p></p> 默认情况下, 调用一个函数需要引号. 可以使用 <code class="cod">unquoted</code> 关键字指明一个函数的参数不需要使用引号. <p></p><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg45f9c4a28f2736a386b676e3d0af4dab" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img45f9c4a28f2736a386b676e3d0af4dab" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;45f9c4a28f2736a386b676e3d0af4dab&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;45f9c4a28f2736a386b676e3d0af4dab&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;45f9c4a28f2736a386b676e3d0af4dab&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre45f9c4a28f2736a386b676e3d0af4dab">@startuml
!unquoted function id($text1, $text2=&#34;FOO&#34;) return $text1 + $text2

alice -&gt; bob : id(aa)
alice -&gt; bob : id(ab,cd)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="116" height="153" class="scale" src="../imgw/img-45f9c4a28f2736a386b676e3d0af4dab.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><p></p><a style="position:relative;top:-38px;" name="f6abbca02be31ee1"></a><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#9"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#9"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#9"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>关键字参数</h2><p></p> 和Python一样，你可以使用关键字参数： <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msgee95cb2f65346c9c3857d0abd77528e1" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imgee95cb2f65346c9c3857d0abd77528e1" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;ee95cb2f65346c9c3857d0abd77528e1&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;ee95cb2f65346c9c3857d0abd77528e1&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;ee95cb2f65346c9c3857d0abd77528e1&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="preee95cb2f65346c9c3857d0abd77528e1">@startuml

!unquoted procedure $element($alias, $description=&#34;&#34;, $label=&#34;&#34;, $technology=&#34;&#34;, $size=12, $colour=&#34;green&#34;)
rectangle $alias as &#34;
&lt;color:$colour&gt;&lt;&lt;$alias&gt;&gt;&lt;/color&gt;
==$label==
//&lt;size:$size&gt;[$technology]&lt;/size&gt;//

  $description&#34;
!endprocedure

$element(myalias, &#34;This description is %newline()on several lines&#34;, $size=10, $technology=&#34;Java&#34;)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="166" height="131" class="scale" src="../imgw/img-ee95cb2f65346c9c3857d0abd77528e1.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="393335a6fd28a804"></a></p><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-117"></span><!-- ezoic_pub_ad_placeholder-117-longest_content-234x60-117-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-117-longest_content-468x60-117-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-117-longest_content-728x90-117-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-117-longest_content-970x90-117-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#10"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#10"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#10"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Including files or URL [!include, !include_many, !include_once]</h2><p></p> Use the <code class="cod">!include</code> directive to include file in your diagram. Using URL, you can also include file from Internet/Intranet. Protected Internet resources can also be accessed, this is described in <a href="url-authentication.html">URL authentication</a>. <p></p> Imagine you have the very same class that appears in many diagrams. Instead of duplicating the description of this class, you can define a file that contains the description. <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg2866e376a991ea368dbc118365bf937d" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img2866e376a991ea368dbc118365bf937d" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;2866e376a991ea368dbc118365bf937d&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;2866e376a991ea368dbc118365bf937d&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;2866e376a991ea368dbc118365bf937d&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre2866e376a991ea368dbc118365bf937d">@startuml

interface List
List : int size()
List : void clear()
List &lt;|.. ArrayList
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="101" height="204" class="scale" src="../imgw/img-2866e376a991ea368dbc118365bf937d.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><strong>File List.iuml</strong><p><code></code></p><pre class="colo"><code>interface List
List : int size()
List : void clear()
</code></pre><p></p><p></p> The file <code class="cod">List.iuml</code> can be included in many diagrams, and any modification in this file will change all diagrams that include it. <p></p> You can also put several <code class="cod">@startuml/@enduml</code> text block in an included file and then specify which block you want to include adding <code class="cod">!0</code> where <code class="cod">0</code> is the block number. The <code class="cod">!0</code> notation denotes the first diagram. <p></p> For example, if you use <code class="cod">!include foo.txt!1</code>, the second <code class="cod">@startuml/@enduml</code> block within <code class="cod">foo.txt</code> will be included. <p></p> You can also put an id to some <code class="cod">@startuml/@enduml</code> text block in an included file using <code class="cod">@startuml(id=MY_OWN_ID)</code> syntax and then include the block adding <code class="cod">!MY_OWN_ID</code> when including the file, so using something like <code class="cod">!include foo.txt!MY_OWN_ID</code>. <p></p> By default, a file can only be included once. You can use <code class="cod">!include_many</code> instead of <code class="cod">!include</code> if you want to include some file several times. Note that there is also a <code class="cod">!include_once</code> directive that raises an error if a file is included several times. <a style="position:relative;top:-38px;" name="98ecfc06b2af9277"></a><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#11"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#11"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#11"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Including Subpart [!startsub, !endsub, !includesub]</h2><p></p> You can also use <code class="cod">!startsub NAME</code> and <code class="cod">!endsub</code> to indicate sections of text to include from other files using <code class="cod">!includesub</code>. For example: <p></p><strong>file1.puml:</strong><p><code></code></p><pre class="colo"><code>@startuml

A -&gt; A : stuff1
!startsub BASIC
B -&gt; B : stuff2
!endsub
C -&gt; C : stuff3
!startsub BASIC
D -&gt; D : stuff4
!endsub
@enduml
</code></pre><p></p><p></p> file1.puml would be rendered exactly as if it were: <p><code></code></p><pre class="colo"><code>@startuml

A -&gt; A : stuff1
B -&gt; B : stuff2
C -&gt; C : stuff3
D -&gt; D : stuff4
@enduml
</code></pre><p></p><p></p><p></p> However, this would also allow you to have another file2.puml like this: <p></p><strong>file2.puml</strong><p><code></code></p><pre class="colo"><code>@startuml

title this contains only B and D
!includesub file1.puml!BASIC
@enduml
</code></pre><p></p><p></p> This file would be rendered exactly as if: <p></p><p><code></code></p><pre class="colo"><code>@startuml

title this contains only B and D
B -&gt; B : stuff2
D -&gt; D : stuff4
@enduml
</code></pre><p><a style="position:relative;top:-38px;" name="291cabbe982ff775"></a></p><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-118"></span><!-- ezoic_pub_ad_placeholder-118-incontent_5-234x60-118-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-118-incontent_5-468x60-118-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-118-incontent_5-728x90-118-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-118-incontent_5-970x90-118-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#12"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#12"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#12"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Builtin functions [%]</h2><p></p> Some functions are defined by default. Their name starts by <code class="cod">%</code><p></p><table border="1" cellspacing="0" cellpadding="5"><tbody><tr><td><b> Name </b></td><td><b> Description </b></td><td><b> Example </b></td><td><b> Return </b></td></tr><tr><td><code class="cod">%chr</code></td><td> Return a character from a give Unicode value </td><td><code class="cod">%chr(65)</code></td><td><code class="cod">A</code></td></tr><tr><td><code class="cod">%darken</code></td><td> Return a darken color of a given color with some ratio </td><td><code class="cod">%darken(&#34;red&#34;, 20)</code></td><td><code class="cod">#CC0000</code></td></tr><tr><td><code class="cod">%date</code></td><td> Retrieve current date. You can provide an optional <a href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">format for the date</a></td><td><code class="cod">%date(&#34;yyyy.MM.dd&#39; at &#39;HH:mm&#34;)</code></td><td> current date </td></tr><tr><td></td><td> You can provide another optional time (<a href="https://en.wikipedia.org/wiki/Epoch%5F%28computing%29">on epoch format</a>) </td><td><code class="cod">%date(&#34;YYYY-MM-dd&#34;, %now() + 1*24*3600)</code></td><td> tomorrow date </td></tr><tr><td><code class="cod">%dec2hex</code></td><td> Return the hexadecimal string (String) of a decimal value (Int) </td><td><code class="cod">%dec2hex(12)</code></td><td><code class="cod">c</code></td></tr><tr><td><code class="cod">%dirpath</code></td><td> Retrieve current dirpath </td><td><code class="cod">%dirpath()</code></td><td> current path </td></tr><tr><td><code class="cod">%feature</code></td><td> Check if some feature is available in the current PlantUML running version </td><td><code class="cod">%feature(&#34;theme&#34;)</code></td><td><code class="cod">true</code></td></tr><tr><td><code class="cod">%false</code></td><td> Return always <code class="cod">false</code></td><td><code class="cod">%false()</code></td><td><code class="cod">false</code></td></tr><tr><td><code class="cod">%file_exists</code></td><td> Check if a file exists on the local filesystem </td><td><code class="cod">%file_exists(&#34;c:/foo/dummy.txt&#34;)</code></td><td><code class="cod">true</code> if the file exists </td></tr><tr><td><code class="cod">%filename</code></td><td> Retrieve current filename </td><td><code class="cod">%filename()</code></td><td> current filename </td></tr><tr><td><code class="cod">%function_exists</code></td><td> Check if a function exists </td><td><code class="cod">%function_exists(&#34;$some_function&#34;)</code></td><td><code class="cod">true</code> if the function has been defined </td></tr><tr><td><code class="cod">%get_variable_value</code></td><td> Retrieve some variable value </td><td><code class="cod">%get_variable_value(&#34;$my_variable&#34;)</code></td><td> the value of the variable </td></tr><tr><td><code class="cod">%getenv</code></td><td> Retrieve environment variable value </td><td><code class="cod">%getenv(&#34;OS&#34;)</code></td><td> the value of <code class="cod">OS</code> variable </td></tr><tr><td><code class="cod">%hex2dec</code></td><td> Return the decimal value (Int) of a hexadecimal string (String) </td><td><code class="cod">%hex2dec(&#34;d&#34;)</code> or <code class="cod">%hex2dec(d)</code></td><td><code class="cod">13</code></td></tr><tr><td><code class="cod">%hsl_color</code></td><td> Return the RGBa color from a HSL color <code class="cod">%hsl_color(h, s, l)</code> or <code class="cod">%hsl_color(h, s, l, a)</code></td><td><code class="cod">%hsl_color(120, 100, 50)</code></td><td><code class="cod">#00FF00</code></td></tr><tr><td><code class="cod">%intval</code></td><td> Convert a String to Int </td><td><code class="cod">%intval(&#34;42&#34;)</code></td><td> 42 </td></tr><tr><td><code class="cod">%is_dark</code></td><td> Check if a color is a dark one </td><td><code class="cod">%is_dark(&#34;#000000&#34;)</code></td><td><code class="cod">true</code></td></tr><tr><td><code class="cod">%is_light</code></td><td> Check if a color is a light one </td><td><code class="cod">%is_light(&#34;#000000&#34;)</code></td><td><code class="cod">false</code></td></tr><tr><td><code class="cod">%lighten</code></td><td> Return a lighten color of a given color with some ratio </td><td><code class="cod">%lighten(&#34;red&#34;, 20)</code></td><td><code class="cod">#CC3333</code></td></tr><tr><td><code class="cod">%load_json</code></td><td><a href="https://github.com/plantuml/plantuml/pull/755">Load JSON data from local file or external URL</a></td><td><code class="cod">%load_json(&#34;http://localhost:7778/management/health&#34;)</code></td><td> JSON data </td></tr><tr><td><code class="cod">%lower</code></td><td> Return a lowercase string </td><td><code class="cod">%lower(&#34;Hello&#34;)</code></td><td><code class="cod">hello</code> in that example </td></tr><tr><td><code class="cod">%newline</code></td><td> Return a newline </td><td><code class="cod">%newline()</code></td><td> a newline </td></tr><tr><td><code class="cod">%not</code></td><td> Return the logical negation of an expression </td><td><code class="cod">%not(2+2==4)</code></td><td><code class="cod">false</code> in that example </td></tr><tr><td><code class="cod">%now</code></td><td> Return the current epoch time </td><td><code class="cod">%now()</code></td><td><code class="cod">1685547132</code> in that example (when updating the doc.) </td></tr><tr><td><code class="cod">%ord</code></td><td> Return a Unicode value from a given character </td><td><code class="cod">%ord(&#34;A&#34;)</code></td><td><code class="cod">65</code></td></tr><tr><td><code class="cod">%lighten</code></td><td> Return a lighten color of a given color with some ratio </td><td><code class="cod">%lighten(&#34;red&#34;, 20)</code></td><td><code class="cod">#CC3333</code></td></tr><tr><td><code class="cod">%reverse_color</code></td><td> Reverse a color using RGB </td><td><code class="cod">%reverse_color(&#34;#FF7700&#34;)</code></td><td><code class="cod">#0088FF</code></td></tr><tr><td><code class="cod">%reverse_hsluv_color</code></td><td> Reverse a color <a href="https://www.hsluv.org/">using HSLuv</a></td><td><code class="cod">%reverse_hsluv_color(&#34;#FF7700&#34;)</code></td><td><code class="cod">#602800</code></td></tr><tr><td><code class="cod">%set_variable_value</code></td><td> Set a global variable </td><td><code class="cod">%set_variable_value(&#34;$my_variable&#34;, &#34;some_value&#34;)</code></td><td> an empty string </td></tr><tr><td><code class="cod">%size</code></td><td> Return the size of any string or JSON structure </td><td><code class="cod">%size(&#34;foo&#34;)</code></td><td><code class="cod">3</code> in the example </td></tr><tr><td><code class="cod">%string</code></td><td> Convert an expression to String </td><td><code class="cod">%string(1 + 2)</code></td><td><code class="cod">3</code> in the example </td></tr><tr><td><code class="cod">%strlen</code></td><td> Calculate the length of a String </td><td><code class="cod">%strlen(&#34;foo&#34;)</code></td><td><code class="cod">3</code> in the example </td></tr><tr><td><code class="cod">%strpos</code></td><td> Search a substring in a string </td><td><code class="cod">%strpos(&#34;abcdef&#34;, &#34;ef&#34;)</code></td><td> 4 (position of <code class="cod">ef</code>) </td></tr><tr><td><code class="cod">%substr</code></td><td> Extract a substring. Takes 2 or 3 arguments </td><td><code class="cod">%substr(&#34;abcdef&#34;, 3, 2)</code></td><td><code class="cod">&#34;de&#34;</code> in the example </td></tr><tr><td><code class="cod">%true</code></td><td> Return always <code class="cod">true</code></td><td><code class="cod">%true()</code></td><td><code class="cod">true</code></td></tr><tr><td><code class="cod">%upper</code></td><td> Return an uppercase string </td><td><code class="cod">%upper(&#34;Hello&#34;)</code></td><td><code class="cod">HELLO</code> in that example </td></tr><tr><td><code class="cod">%variable_exists</code></td><td> Check if a variable exists </td><td><code class="cod">%variable_exists(&#34;$my_variable&#34;)</code></td><td><code class="cod">true</code> if the variable has been defined exists </td></tr><tr><td><code class="cod">%version</code></td><td> Return PlantUML current version </td><td><code class="cod">%version()</code></td><td><code class="cod">1.2020.8</code> for example </td></tr></tbody></table><a style="position:relative;top:-38px;" name="1b4e6e15030cbbfb"></a><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#13"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#13"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#13"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Logging [!log]</h2><p></p> You can use <code class="cod">!log</code> to add some log output when generating the diagram. This has no impact at all on the diagram itself. However, those logs are printed in the command line&#39;s output stream. This could be useful for debug purpose. <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg80d17a73f781cb42c66e41ad7f90cfce" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img80d17a73f781cb42c66e41ad7f90cfce" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;80d17a73f781cb42c66e41ad7f90cfce&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;80d17a73f781cb42c66e41ad7f90cfce&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;80d17a73f781cb42c66e41ad7f90cfce&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre80d17a73f781cb42c66e41ad7f90cfce">@startuml
!function bold($text)
!$result = &#34;&lt;b&gt;&#34;+ $text +&#34;&lt;/b&gt;&#34;
!log Calling bold function with $text. The result is $result
!return $result
!endfunction

Alice -&gt; Bob : This is bold(&#34;bold&#34;)
Alice -&gt; Bob : This is bold(&#34;a second call&#34;)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="201" height="153" class="scale" src="../imgw/img-80d17a73f781cb42c66e41ad7f90cfce.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="d19672e248f49513"></a></p><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-119"></span><!-- ezoic_pub_ad_placeholder-119-incontent_6-234x60-119-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-119-incontent_6-468x60-119-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-119-incontent_6-728x90-119-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-119-incontent_6-970x90-119-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#14"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#14"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#14"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Memory dump [!dump_memory]</h2><p></p> You can use <code class="cod">!dump_memory</code> to dump the full content of the memory when generating the diagram. An optional string can be put after <code class="cod">!dump_memory</code>. This has no impact at all on the diagram itself. This could be useful for debug purpose. <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg50f8e1e79c6c7f786eb48cfd23f867bf" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img50f8e1e79c6c7f786eb48cfd23f867bf" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;50f8e1e79c6c7f786eb48cfd23f867bf&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;50f8e1e79c6c7f786eb48cfd23f867bf&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;50f8e1e79c6c7f786eb48cfd23f867bf&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre50f8e1e79c6c7f786eb48cfd23f867bf">@startuml
!function $inc($string)
!$val = %intval($string)
!log value is $val
!dump_memory
!return $val+1
!endfunction

Alice -&gt; Bob : 4 $inc(&#34;3&#34;)
!unused = &#34;foo&#34;
!dump_memory EOF
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="103" height="123" class="scale" src="../imgw/img-50f8e1e79c6c7f786eb48cfd23f867bf.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="a722dcfcf491402a"></a></p><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#15"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#15"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#15"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Assertion [!assert]</h2><p></p> You can put assertions in your diagram. <p></p><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg4523a64902d32cc919c8663551804796" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img4523a64902d32cc919c8663551804796" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;4523a64902d32cc919c8663551804796&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;4523a64902d32cc919c8663551804796&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;4523a64902d32cc919c8663551804796&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre4523a64902d32cc919c8663551804796">@startuml
Alice -&gt; Bob : Hello
!assert %strpos(&#34;abcdef&#34;, &#34;cd&#34;)==3 : &#34;This always fails&#34;
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="540" height="367" class="scale" src="../imgw/img-4523a64902d32cc919c8663551804796.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="2f3a396cf56164bd"></a></p><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-120"></span><!-- ezoic_pub_ad_placeholder-120-incontent_7-234x60-120-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-120-incontent_7-468x60-120-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-120-incontent_7-728x90-120-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-120-incontent_7-970x90-120-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#16"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#16"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#16"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Building custom library [!import, !include]</h2><p></p> It&#39;s possible to package a set of included files into a single .zip or .jar archive. This single zip/jar can then be imported into your diagram using <code class="cod">!import</code> directive. <p></p> Once the library has been imported, you can <code class="cod">!include</code> file from this single zip/jar. <p></p><strong>Example:</strong><p><code></code></p><pre class="colo"><code>@startuml

!import /path/to/customLibrary.zip
&#39; This just adds &#34;customLibrary.zip&#34; in the search path

!include myFolder/myFile.iuml
&#39; Assuming that myFolder/myFile.iuml is located somewhere
&#39; either inside &#34;customLibrary.zip&#34; or on the local filesystem

...
</code></pre><p><a style="position:relative;top:-38px;" name="4d03410776ebc180"></a></p><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#17"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#17"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#17"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Search path</h2><p></p> You can specify the java property <code class="cod">plantuml.include.path</code> in the command line. <p></p> For example: <p></p><p><code></code></p><pre class="colo"><code>java -Dplantuml.include.path=&#34;c:/mydir&#34; -jar plantuml.jar atest1.txt
</code></pre><p></p><p></p><p></p> Note the this -D option has to put before the -jar option. -D options after the -jar option will be used to define constants within plantuml preprocessor. <p></p><a style="position:relative;top:-38px;" name="8b0c49aba5ff40a5"></a><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-121"></span><!-- ezoic_pub_ad_placeholder-121-incontent_8-234x60-121-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-121-incontent_8-468x60-121-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-121-incontent_8-728x90-121-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-121-incontent_8-970x90-121-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#18"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#18"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#18"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Argument concatenation [##]</h2><p></p><p></p> It is possible to append text to a macro argument using the <code class="cod">##</code> syntax. <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg0b0ac3c67cc8c4a3d83c42027fc648f0" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img0b0ac3c67cc8c4a3d83c42027fc648f0" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;0b0ac3c67cc8c4a3d83c42027fc648f0&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;0b0ac3c67cc8c4a3d83c42027fc648f0&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;0b0ac3c67cc8c4a3d83c42027fc648f0&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre0b0ac3c67cc8c4a3d83c42027fc648f0">@startuml
!unquoted procedure COMP_TEXTGENCOMP(name)
[name] &lt;&lt; Comp &gt;&gt;
interface Ifc &lt;&lt; IfcType &gt;&gt; AS name##Ifc
name##Ifc - [name]
!endprocedure
COMP_TEXTGENCOMP(dummy)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="180" height="81" class="scale" src="../imgw/img-0b0ac3c67cc8c4a3d83c42027fc648f0.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="5a1670d800446678"></a></p><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#19"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#19"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#19"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Dynamic invocation [<code class="cod">%invoke_procedure()</code>, <code class="cod">%call_user_func()</code>]</h2><p></p> You can dynamically invoke a procedure using the special <code class="cod">%invoke_procedure()</code> procedure. This procedure takes as first argument the name of the actual procedure to be called. The optional following arguments are copied to the called procedure. <p></p> For example, you can have: <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msge81b2a226bf70190781b0a6ec9b935fa" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imge81b2a226bf70190781b0a6ec9b935fa" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;e81b2a226bf70190781b0a6ec9b935fa&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;e81b2a226bf70190781b0a6ec9b935fa&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;e81b2a226bf70190781b0a6ec9b935fa&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pree81b2a226bf70190781b0a6ec9b935fa">@startuml
!procedure $go()
  Bob -&gt; Alice : hello
!endprocedure

!$wrapper = &#34;$go&#34;

%invoke_procedure($wrapper)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="103" height="123" class="scale" src="../imgw/img-e81b2a226bf70190781b0a6ec9b935fa.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msgfeccc25d7d3e33c0c31340f2d71d9086" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imgfeccc25d7d3e33c0c31340f2d71d9086" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;feccc25d7d3e33c0c31340f2d71d9086&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;feccc25d7d3e33c0c31340f2d71d9086&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;feccc25d7d3e33c0c31340f2d71d9086&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="prefeccc25d7d3e33c0c31340f2d71d9086">@startuml
!procedure $go($txt)
  Bob -&gt; Alice : $txt
!endprocedure

%invoke_procedure(&#34;$go&#34;, &#34;hello from Bob...&#34;)
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="170" height="123" class="scale" src="../imgw/img-feccc25d7d3e33c0c31340f2d71d9086.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><p></p> For return functions, you can use the corresponding special function <code class="cod">%call_user_func()</code> : <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msgc390f71064c4d045e7cff44f45e2fd0e" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imgc390f71064c4d045e7cff44f45e2fd0e" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;c390f71064c4d045e7cff44f45e2fd0e&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;c390f71064c4d045e7cff44f45e2fd0e&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;c390f71064c4d045e7cff44f45e2fd0e&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="prec390f71064c4d045e7cff44f45e2fd0e">@startuml
!function bold($text)
!return &#34;&lt;b&gt;&#34;+ $text +&#34;&lt;/b&gt;&#34;
!endfunction

Alice -&gt; Bob : %call_user_func(&#34;bold&#34;, &#34;Hello&#34;) there
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="141" height="123" class="scale" src="../imgw/img-c390f71064c4d045e7cff44f45e2fd0e.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="f8d8089a98ca8958"></a></p><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-122"></span><!-- ezoic_pub_ad_placeholder-122-incontent_9-234x60-122-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-122-incontent_9-468x60-122-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-122-incontent_9-728x90-122-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-122-incontent_9-970x90-122-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#20"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#20"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#20"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Evaluation of addition depending of data types [+]</h2><p></p> Evaluation of <code class="cod">$a + $b</code> depending of type of <code class="cod">$a</code> or <code class="cod">$b</code><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg2a4f54341024cf60de9f5f2e7a6e349b" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img2a4f54341024cf60de9f5f2e7a6e349b" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;2a4f54341024cf60de9f5f2e7a6e349b&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;2a4f54341024cf60de9f5f2e7a6e349b&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;2a4f54341024cf60de9f5f2e7a6e349b&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre2a4f54341024cf60de9f5f2e7a6e349b">@startuml
title
&lt;#LightBlue&gt;|= |=  $a |=  $b |=  &lt;U+0025&gt;string($a + $b)|
&lt;#LightGray&gt;| type | str | str | str (concatenation) |
| example |= &#34;a&#34; |= &#34;b&#34; |= %string(&#34;a&#34; + &#34;b&#34;) |
&lt;#LightGray&gt;| type | str | int | str (concatenation) |
| ex.|= &#34;a&#34; |=  2  |= %string(&#34;a&#34; + 2)   |
&lt;#LightGray&gt;| type | str | int | str (concatenation) |
| ex.|=  1  |= &#34;b&#34; |= %string(1 + &#34;b&#34;)   |
&lt;#LightGray&gt;| type | bool | str | str (concatenation) |
| ex.|= &lt;U+0025&gt;true() |= &#34;b&#34; |= %string(%true() + &#34;b&#34;) |
&lt;#LightGray&gt;| type | str | bool | str (concatenation) |
| ex.|= &#34;a&#34; |= &lt;U+0025&gt;false() |= %string(&#34;a&#34; + %false()) |
&lt;#LightGray&gt;| type |  int  |  int | int (addition of int) |
| ex.|=  1  |=  2  |= %string(1 + 2)     |
&lt;#LightGray&gt;| type |  bool  |  int | int (addition) |
| ex.|= &lt;U+0025&gt;true() |= 2 |= %string(%true() + 2) |
&lt;#LightGray&gt;| type |  int  |  bool | int (addition) |
| ex.|=  1  |= &lt;U+0025&gt;false() |= %string(1 + %false()) |
&lt;#LightGray&gt;| type |  int  |  int | int (addition) |
| ex.|=  1  |=  &lt;U+0025&gt;intval(&#34;2&#34;)  |= %string(1 + %intval(&#34;2&#34;)) |
end title
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="389" height="365" class="scale" src="../imgw/img-2a4f54341024cf60de9f5f2e7a6e349b.png"/></div></div></td></tr></tbody></table></p><p><a style="position:relative;top:-38px;" name="12df2101f7bc5968"></a></p><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#21"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#21"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#21"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Preprocessing JSON</h2><p></p> You can extend the functionality of the current Preprocessing with <a href="preprocessing-json.html">JSON Preprocessing</a> features: <p></p><ul><li>JSON Variable definition</li><li>Access to JSON data</li><li>Loop over JSON array</li></ul><p></p><em>(See more details on <a href="preprocessing-json.html">Preprocessing-JSON page</a>)</em><a style="position:relative;top:-38px;" name="01cdcc6a490aa8ce"></a><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-123"></span><!-- ezoic_pub_ad_placeholder-123-incontent_10-234x60-123-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-123-incontent_10-468x60-123-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-123-incontent_10-728x90-123-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-123-incontent_10-970x90-123-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#22"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#22"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#22"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>Including theme [!theme]</h2><p></p> Use the <code class="cod">!theme</code> directive to change <a href="theme.html">the default theme of your diagram</a>. <p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msg2ad6f83492e15e002e5175339c52e14a" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="img2ad6f83492e15e002e5175339c52e14a" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;2ad6f83492e15e002e5175339c52e14a&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;2ad6f83492e15e002e5175339c52e14a&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;2ad6f83492e15e002e5175339c52e14a&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="pre2ad6f83492e15e002e5175339c52e14a">@startuml
!theme spacelab
class Example {
  Theme spacelab
}
@enduml
</pre></code></div><div class="mycell"><img loading="lazy" width="156" height="112" class="scale" src="../imgw/img-2ad6f83492e15e002e5175339c52e14a.png"/></div></div></td></tr></tbody></table></p><p></p><p></p> You will find more information <a href="theme.html">on the dedicated page</a>. <a style="position:relative;top:-38px;" name="0625790a47906fd3"></a><div style="clear:both;height:50px;"></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#23"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#23"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#23"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div>迁移说明</h2><p></p> 目前的预处理是由<a href="https://plantuml.com/zh/preprocessing-legacy">legacy preprocessor.</a>升级而来. <p></p> 虽然一些历史遗留功能仍被目前的预处理支持, 但是你不应该继续使用 (他们不久将会被移除). <p></p><p></p><ul><li>You should not use <code class="cod">!define</code> and <code class="cod">!definelong</code> anymore. Use <code class="cod">!function</code>, <code class="cod">!procedure</code> or variable definition instead. <code class="cod">!define</code> should be replaced by return <code class="cod">!function</code> and <code class="cod">!definelong</code> should be replaced by <code class="cod">!procedure</code>.</li><li>你不应该再使用 <code class="cod">!define</code> 和 <code class="cod">!definelong</code>. 使用 <code class="cod">!function</code> 和定义变量替换他们. <code class="cod">!define</code>替换为 返回函数 而 <code class="cod">!definelong</code> 应该替换为 void function.</li><li><code class="cod">!include</code> 现在允许多包含 : 不应该再使用 <code class="cod">!include_many</code></li><li><code class="cod">!include</code> 现在可以授受URL, 所以不再需要 <code class="cod">!includeurl</code></li><li>一些特性 (比如 <code class="cod">%date%</code>) 替换为内建函数 (例如 <code class="cod">%date()</code>)</li><li>当不带参数调用历史遗留<code class="cod">!definelong</code> 宏的时候, 你必须使用括号. 必须使用 <code class="cod">my_own_definelong()</code> 因为 <code class="cod">my_own_definelong</code>不带括号的形式不被新的预处理语法解析.</li></ul><p></p><p></p><p></p> 如果你有什么疑问请联系我们. <a style="position:relative;top:-38px;" name="0c3c8fa7461e8976"></a><div style="clear:both;min-height:110px;margin-top:10px;"><div class="pezoic"><span id="ezoic-pub-ad-placeholder-194"></span><!-- ezoic_pub_ad_placeholder-194-incontent_11-234x60-194-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-194-incontent_11-468x60-194-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-194-incontent_11-728x90-194-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-194-incontent_11-970x90-194-nonexxxnonexxxxxxezmaxscaleval100 --></div></div><h2 class="chap"><img onclick="window.scrollTo(0,0);" title="Back to top" src="../backtop1.svg" width="20" height="20" class="backtop"/><div class="dropdown"><button class="dropbtn"><img width="16" height="16" src="../edit1.svg"/></button><div class="dropdown-content"><a href="http://alphadoc.plantuml.com/cmp/dokuwiki/zh/preprocessing#24"><img width="20" height="20" src="../dokuwiki.png"/>Edit in Dokuwiki</a><a href="http://alphadoc.plantuml.com/cmp/asciidoc/zh/preprocessing#24"><img width="20" height="20" src="../asciidoc32.png"/>Edit in Asciidoc</a><a href="http://alphadoc.plantuml.com/cmp/markdown/zh/preprocessing#24"><img width="20" height="20" src="../markdown.png"/>Edit in Markdown</a></div></div><code class="cod">%Splitstr</code> builtin function</h2><p></p><p><table class="coptable" valign="top" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top"><div id="msgc995c84f1994e2b4fac807ab570e74c6" class="msg"> 🎉 Copied! </div><img loading="lazy" width="16" height="16" id="imgc995c84f1994e2b4fac807ab570e74c6" title="Copy to clipboard" class="cop" src="../clipboard1.svg" onclick="ctc(&#39;c995c84f1994e2b4fac807ab570e74c6&#39;)"/><br/><img loading="lazy" width="16" height="16" title="Edit online" class="cop" src="../edit1.svg" onclick="javascript:ljs(&#39;c995c84f1994e2b4fac807ab570e74c6&#39;)"/></td><td><div class="mytab" onclick="javascript:ljs(&#39;c995c84f1994e2b4fac807ab570e74c6&#39;)"><div class="mycell0"><code onmouseover="az=1" onmouseout="az=0"><pre id="prec995c84f1994e2b4fac807ab570e74c6">@startmindmap
!$list = %splitstr(&#34;abc~def~ghi&#34;, &#34;~&#34;)

* root
!foreach $item in $list
  ** $item
!endfor
@endmindmap
</pre></code></div><div class="mycell"><img loading="lazy" width="159" height="193" class="scale" src="../imgw/img-c995c84f1994e2b4fac807ab570e74c6.png"/></div></div></td></tr></tbody></table></p><p></p><p></p><em>[Ref. <a href="https://forum.plantuml.net/15374/delimited-string-split-into-an-array">QA-15374</a>]</em></td><td id="toctd" valign="top" style="max-width:240px;min-width:240px;"><div id="toc"><ul><li><a href="preprocessing.html#788fa5fb2276ed17">定义变量</a></li><li><a href="preprocessing.html#55eb000153a81c72">布尔表达式</a></li><li><a href="preprocessing.html#662c2b949d1265d3">条件</a></li><li><a href="preprocessing.html#7771e9f2c2e2630a">While 循环 [!while, !endwhile]</a></li><li><a href="preprocessing.html#01deeaa12f04fb9d">空函数</a></li><li><a href="preprocessing.html#f47019cc66524b5f">返回函数</a></li><li><a href="preprocessing.html#ae1b47605326b65f">参数默认值</a></li><li><a href="preprocessing.html#566b25a8fa128eec">非引号函数</a></li><li><a href="preprocessing.html#f6abbca02be31ee1">关键字参数</a></li><li><a href="preprocessing.html#393335a6fd28a804">Including files or URL [!include, !include\_many, !include\_once]</a></li><li><a href="preprocessing.html#98ecfc06b2af9277">Including Subpart [!startsub, !endsub, !includesub]</a></li><li><a href="preprocessing.html#291cabbe982ff775">Builtin functions [%]</a></li><li><a href="preprocessing.html#1b4e6e15030cbbfb">Logging [!log]</a></li><li><a href="preprocessing.html#d19672e248f49513">Memory dump [!dump\_memory]</a></li><li><a href="preprocessing.html#a722dcfcf491402a">Assertion [!assert]</a></li><li><a href="preprocessing.html#2f3a396cf56164bd">Building custom library [!import, !include]</a></li><li><a href="preprocessing.html#4d03410776ebc180">Search path</a></li><li><a href="preprocessing.html#8b0c49aba5ff40a5">Argument concatenation [##]</a></li><li><a href="preprocessing.html#5a1670d800446678">Dynamic invocation [`+%invoke_procedure()+`, `+%call_user_func()+`]</a></li><li><a href="preprocessing.html#f8d8089a98ca8958">Evaluation of addition depending of data types [+]</a></li><li><a href="preprocessing.html#12df2101f7bc5968">Preprocessing JSON</a></li><li><a href="preprocessing.html#01cdcc6a490aa8ce">Including theme [!theme]</a></li><li><a href="preprocessing.html#0625790a47906fd3">迁移说明</a></li><li><a href="preprocessing.html#0c3c8fa7461e8976">`+%Splitstr+` builtin function</a></li></ul></div></td></tr></tbody></table></p><p></p><span id="ezoic-pub-ad-placeholder-104"></span><!-- ezoic_pub_ad_placeholder-104-bottom_of_page-234x60-104-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-104-bottom_of_page-468x60-104-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-104-bottom_of_page-728x90-104-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-104-bottom_of_page-970x250-104-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-104-bottom_of_page-300x250x3-104-nonexxxnonexxxxxxezmaxscaleval100 --><!-- ezoic_pub_ad_placeholder-104-bottom_of_page-970x90-104-nonexxxnonexxxxxxezmaxscaleval100 --></div><style>.btm{text-align:center}.btm a{text-decoration:none;color:#637282}.btm a:hover{color:#0366d6}</style><div class="btm"><hr/><a href="https://g.ezoic.net/privacy/plantuml.com"><small>Privacy Policy</small></a>      <a href="../direct-sales.html"><small>Advertise</small></a><p></p></div><script>var sc_project=11129481;var sc_invisible=1;var sc_security="bd89fcfd";</script><script async="" src="https://www.statcounter.com/counter/counter.js"></script><!--[selectrongo:done]--><script type="text/javascript">
				var __inScopeForCCPA = false;
		function __uspapi(command, version, callback) {
			var response = null;
			var successs = false;
			if (command === "getUSPData" && version === 1) {
				var uspString = "1"; // Version
				if (__inScopeForCCPA) {
					uspString += "N"; // Has Explicit Notice for Opt Out been provided (ex footer or minor consent modal)
					var result;
					var consentCookie = (result = new RegExp('(?:^|; )ezoccpaconsent=([^;]*)').exec(document.cookie)) ? (result[1]) : null;
					if (consentCookie === "nonconsent") {
						uspString += "Y";
					}
					else {
						uspString += "N";
					}
					uspString += "N" // Is pub a signatory to the IAB Limited Service Provider Agreement (http://www.iabprivacy.com/)
				}
				else {
					uspString += "---";
				}
				response = {
					uspString: uspString,
					version: 1
				};
				success = true;
			}
			return callback(response, success);
		};
		function __receiveUspapiMessage(event) {
			if (event.data.hasOwnProperty('__uspapiCall')) {
				__uspapi('getUSPData', 1, function(uspData, success) {
					event.source.postMessage({
						__uspapiReturn: {
							returnValue: uspData,
							success: success,
							callId: event.data.__uspapiCall.callId
						}
					},
					event.origin);
				});
			}
			return null;
		};
		window.addEventListener("message", __receiveUspapiMessage, false);
</script>
<script>__ez.queue.addFile('/tardisrocinante/vitals.js', '/tardisrocinante/vitals.js?gcb=2&cb=3', false, ['/parsonsmaize/mulvane.js'], true, false, true, false);</script>
<script>var _audins_dom="plantuml_com",_audins_did=173770;__ez.queue.addDelayFunc("audins.js","__ez.script.add", "//go.ezodn.com/detroitchicago/audins.js?cb=195-2");</script><noscript><div style="display:none;"><img src="https://pixel.quantserve.com/pixel/p-31iz6hfFutd16.gif?labels=Domain.plantuml_com,DomainId.173770" border="0" height="1" width="1" alt="Quantcast"/></div></noscript>
<script>__ez.queue.addFile('/beardeddragon/drake.js', '/beardeddragon/drake.js?gcb=2&cb=4', false, [], true, false, true, false);</script>
<script type="text/javascript" style='display:none;'>var __ez_dims = (function() {
		var setCookie = function( name, content, expiry ) {
			return document.cookie = name+'='+content+((expiry)?';expires='+(new Date(Math.floor(new Date().getTime()+expiry*1000)).toUTCString()):'')+';path=/';
		};
		var ffid = 1;
		var oh = window.screen.height;
		var ow = window.screen.width;
		var h = ffid === 1 ? oh : (oh > ow) ? oh : ow;
		var w = ffid === 1 ? ow : (oh > ow) ? ow : oh;
		var uh = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;
		var uw = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
		setCookie('ezds', encodeURIComponent('ffid='+ffid+',w='+w+',h='+h), (31536e3*7));
		setCookie('ezohw', encodeURIComponent('w='+uw+',h='+uh), (31536e3*7));
	})();</script>
<script type='text/javascript' style='display:none;' async>__ez.queue.addFile('/parsonsmaize/chanute.js', '/parsonsmaize/chanute.js?a=a&cb=7&dcb=195-2&shcb=34', true, ['/parsonsmaize/mulvane.js'], true, false, false, false);</script>
<script type='text/javascript' style='display:none;' async>__ez.queue.addFile('/porpoiseant/jellyfish.js', '/porpoiseant/jellyfish.js?a=a&cb=10&dcb=195-2&shcb=34', false, [], true, false, false, false);</script></body></html>